package edu.cuit.zhuyimeng.ticket.api.controller;

import edu.cuit.zhuyimeng.framework.common.result.CommonResult;
import jakarta.validation.constraints.NotNull;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 航班调度接口
 */
@FeignClient(value = "ticket-service",contextId = "ticket-dispatch",path = "manage")
public interface TicketDispatchApiController {

    /**
     * 开放航班订票
     */
    @PutMapping("/")
    CommonResult<Void> openFlightBooking(@RequestParam("flightId")Long flightId);

    /**
     * 关闭航班订票
     */
    @DeleteMapping("/")
    CommonResult<Void> closeFlightBooking(@RequestParam("flightId") Long flightId);

    /**
     * 删除机票
     */
    @DeleteMapping("/ticket")
   CommonResult<Void> deleteTicket(@RequestParam("flightId") Long flightId);

    /**
     * 刷新缓存（航班信息改变）
     */
    @PostMapping("/cache")
    CommonResult<Void> refreshCache(@RequestParam("flightId") Long flightId);

}
